(el-get 'sync '(auto-complete clang-complete-async auto-complete-c-headers))
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/el-get/auto-complete/dict")
(setq ac-auto-start t)
(setq ac-quick-help-delay 0.5)

;;; auto-complete key binding config
(define-key ac-menu-map (kbd "M-n") 'ac-next)
(define-key ac-menu-map (kbd "M-p") 'ac-previous)
(ac-set-trigger-key "TAB")
(ac-set-trigger-key "<tab>")
;;; auto-complete key binding config end

;;; auto-complete-c-header config
(defun my:ac-c-header-init()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers)
  (add-to-list 'achead:include-directories '
               "
                /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2
                /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/x86_64-unknown-linux-gnu
                /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/backward
                /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include
                /usr/local/include
                /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include-fixed
                /usr/include"))
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
;;; auto-complete-c-header config end

;;; auto-complete-clang-async config
(require 'auto-complete-clang-async)
(defun ac-cc-mode-setup ()
  (setq ac-clang-complete-executable "~/.emacs.d/el-get/clang-complete-async/clang-complete")
  (setq ac-sources '(ac-source-clang-async))
  (ac-clang-launch-completion-process)
  )

(defun my-async-config ()
  (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
  (add-hook 'auto-complete-mode-hook 'ac-common-setup)
  (global-auto-complete-mode t))
(my-async-config)
;;; auto-complete-clang-async config end

(provide 'init-auto-complete)
